<template>
<div>
  <HomeHeader :city="city"></HomeHeader>
  <swiper :list="swiperList"></swiper>
  <icons :iconList="iconList"></icons>
  <recommend :recommendList="recommendList"></recommend>
  <homeWeek :weekendList="weekendList"></homeWeek>
</div>
</template>

<script>
import HomeHeader from './components/HomeHeader.vue'
import swiper from './components/swiper.vue'
import icons from './components/icons.vue'
import recommend from './components/recommend.vue'
import homeWeek from './components/homeWeek.vue'
import axios from 'axios'
export default {
  name: 'Home',
  components: {
    HomeHeader,
    swiper,
    icons,
    recommend,
    homeWeek
  },
  data () {
    return {
    city: '',
    list:[],
    iconList: [],
    recommendList: [],
    weekendList: [],
    swiperList:[]
    }
  },
  methods: {
    getHomeInfo () {
      axios.get('/api/index.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (rec) {
      rec = rec.data
      if(rec.ret && rec.data){
        const data = rec.data
        this.city = data.city
        this.swiperList = data.swiperList
        this.iconList = data.iconList
        this.recommendList = data.recommendList
        this.weekendList = data.weekendList
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>

<style>

</style>
